//
//  DebugAppInfoCell.m
//  YK_DebugManager
//
//  Created by edward on 2021/2/24.
//

#import "DebugAppInfoCell.h"

#define labelwidth 120
#define labelheight 40

@interface DebugAppInfoCell ()

///
@property(nonatomic,strong) UILabel *titleLabel;

///
@property(nonatomic,strong) UILabel *detailLabel;

@end

@implementation DebugAppInfoCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.detailLabel];
}

- (void)setTitle:(NSString *)title detail:(NSString *)detail
{
    self.titleLabel.text = title;
    self.detailLabel.text = detail;
}

- (UILabel *)titleLabel
{
    if(!_titleLabel)
    {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 15/2, 90, labelheight)];
        if (@available(iOS 13.0, *)) {
            _titleLabel.textColor = UIColor.labelColor;
        } else {
            _titleLabel.textColor = UIColor.blackColor;
        }
        _titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold];
    }
    _titleLabel.textAlignment = NSTextAlignmentLeft;
    return _titleLabel;
}

- (UILabel *)detailLabel
{
    if (!_detailLabel) {
        _detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + 10, 15/2, (UIScreen.mainScreen.bounds.size.width - 20 - CGRectGetMaxX(self.titleLabel.frame)), labelheight)];
        if (@available(iOS 13.0, *)) {
            _detailLabel.textColor = UIColor.labelColor;
        } else {
            _detailLabel.textColor = UIColor.blackColor;
        }
        _detailLabel.textAlignment = NSTextAlignmentRight;
        _detailLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
    }
    return _detailLabel;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
